package net.openl10n.adapters;

import java.util.Iterator;

import net.openl10n.mdf.PartId;

public interface DocumentStreamReader<T extends FileFormat> extends Iterator<DocumentStreamReader.Event>{

	/**
	 * StartDocument{id,version}
	 *   StartTextFlow{id,version}
	 *     Content{content}
	 *     InlineContainer{}
	 *       Content
	 *     EndInlineContainer
	 *     StartInlineReference
	 *       
	 *     EndInlineReference
	 *   EndTextFlow
	 * EndDocument
	 * 
	 * TextFlow: Standalone flow of text
	 * Container: A Containment
	 * Reference: A pointer to a separate resource/
	 *
	 *
	 *
	 * <p class='x'> hello world!</p>
	 * StartTextFlow[p] Markup[elem:p,atts[class]] CssClass[x]
	 * Content[ hello world!]
	 * EndTextFlow[] Markup[endelem:p]
	 * 
	 */
	
	public static enum Event{
		Document_Start,
		Document_Finish,
		DataHook,
		Container_Start,
		Container_Finish,
		TextFlow_Start,
		TextFlow_Content,
		TextFlow_Finish,
		ReferencePart;
		
		public boolean isFinishEvent(){
			switch(this){
			case Document_Finish:
			case Container_Finish:
			case TextFlow_Finish:
				return true;
			}
			return false;
		}
		
		public boolean isStartEvent(){
			switch(this){
			case Document_Start:
			case Container_Start:
			case TextFlow_Start:
				return true;
			}
			return false;
		}
		
	}
	
	// DocumentPart
	public PartId getPartId();
	
	// TextFlow
	public String getContent();
	
	public Event current();
	public void close();
		
}
